<template>
  <div class="page_ratingList">
    <van-nav-bar
      title="招企总评分：666分"
      left-arrow
      @click-left="$router.push('/myCompany')"
    >
      <template #right >
        <van-icon name="search" size="20" @click="goNeedPage_rateList('search')"/>
      </template>
    </van-nav-bar>


    <com-filter-menu
      :rightOptionObj="rightOptionObj" :rightOption="rightOption"
      :rightValue="rightValue" @getFilterMenuValue="toGetFilterMenuValue_ratingList"
    ></com-filter-menu>

    <div class="ratingList">
      <com-rate-item
        v-for="(item, index) in 2"
        :key="index"
        :rightValue='rightValue'
        :rateRspObj="rateRspObj"
      ></com-rate-item>
    </div>



  </div>
</template>

<script>
  import comFilterMenu from '../../../components/comFilterMenu';
  import comRateItem from './common/comRateItem';

  const rightOptionObj = {
    'all': '默认',
    'employer_rate': '用企评分',
    'recruitment_rate': '招企用户',
    'jinpin_rate': '平台评分',
  };
  const rightOption = [
    { text: '默认', value: 'all' },
    { text: '用企评分', value: 'employer_rate' },
    { text: '招企用户', value: 'recruitment_rate' },
    { text: '平台评分', value: 'jinpin_rate' },
  ];

  export default {
    name: 'ratingList',
    components: {
      comFilterMenu,
      comRateItem,
    },
    data(){
      return {
        rightValue: 'all',
        rightOption,
        rightOptionObj,
        rateRspObj: {
          rateArr: [
            {
              title: '对用人企业的评价',
              score: -3,
              desc: '考试中每道题的分值相等、枫叶将故事染色 结局我看透',
            },
            {
              title: '对招聘企业的评价',
              score: 4,
              desc: '花开就一次成熟 我却错过、枫叶将故事染色 结局我看透',
            },
            {
              title: '对近聘平台的评价',
              score: 5,
              desc: '谁在用琵琶弹奏、一曲东风破岁月在墙上剥落 看见小时候而如今琴声幽幽 我的等候你没听过',
            }
          ],
          time: '2021-02-22 15:35:17'
        },
      }
    },

    methods: {
      goNeedPage_rateList(val){
        const keyWord = 'ratingList';
        if (val === 'search'){
          this.$router.push({
            path: `/searchRecords/${keyWord}`,
          })
        }
      },

      toGetFilterMenuValue_ratingList(val){
        console.log('传值', val)
        this.rightValue = val;
        if(val != 'all'){
          this.rateRspObj =  {
            rateArr: [
              {
                title: `对${this.rightOptionObj[val]}的评价`,
                score: -3,
                desc: '考试中每道题的分值相等、枫叶将故事染色 结局我看透',
              },
            ],
            time: '2021-02-22 15:35:17'
          }
        } else {
          this.rateRspObj = {
            rateArr: [
              {
                title: '对用人企业的评价',
                score: -3,
                desc: '考试中每道题的分值相等、枫叶将故事染色 结局我看透',
              },
              {
                title: '对招聘企业的评价',
                score: 4,
                desc: '花开就一次成熟 我却错过、枫叶将故事染色 结局我看透',
              },
              {
                title: '对近聘平台的评价',
                score: 5,
                desc: '谁在用琵琶弹奏、一曲东风破岁月在墙上剥落 看见小时候而如今琴声幽幽 我的等候你没听过',
              }
            ],
              time: '2021-02-22 15:35:17'
          }
        }
      },
    },
  }
</script>

<style lang="scss" scoped>
  .page_ratingList{
    width: 100%;
  }
</style>
